package at.com.vn.chess.applet;

import java.awt.Dimension;

import javax.swing.JApplet;

import at.com.vn.chess.listener.ChessTableListener;
import at.com.vn.chess.util.Const;

@SuppressWarnings( "serial" )
public class DummyApplet extends JApplet {
	
	public static final String URL_CHESS_APPLICATION = "http://localhost:8080/ChessApplication";
	private String url_servlet_chat_private = URL_CHESS_APPLICATION + "/ChatPrivateServlet";
	
	String name = "nghi";
	String currentRoomID = "room1";
	int tableID = 1;
	
	ChessPanel chessDialog;
	ChessTableListener listener;
	
	public void init() {
//		Dimension size = new Dimension( Const.DIALOG_WIDTH, Const.DIALOG_HEIGHT + 25 );
//		ChessFrame chessFrame = new ChessFrame( this );	
		ChessFrame chessFrame = new ChessFrame( "nghi table", url_servlet_chat_private, name, currentRoomID, tableID, this );
//		chessFrame.setSize( size );
//		chessFrame.setMinimumSize( size );
		
		listener = new ChessTableListener() {

			@Override
			public void closeClicked() {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void setPlayerClicked( String name, int playerColor,
					String status ) {
				System.out.println( name );				
			}
			
		};
		
		chessFrame.setListener( listener );
		
//		chessDialog.setSize( size );
//		chessFrame.setLocationRelativeTo( null );
		chessFrame.setMinimumSize( new Dimension( Const.DIALOG_WIDTH, Const.DIALOG_HEIGHT + 32 ) );
		chessFrame.setPreferredSize( new Dimension( Const.DIALOG_WIDTH, Const.DIALOG_HEIGHT ) );
		chessFrame.pack();
		chessFrame.setLocationRelativeTo( null );
		chessFrame.setVisible( true );
	}
}